import java.util.*;

public class SimpleStudentSystem {
    private static Map<String, String[]> students = new HashMap<>(); 
    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        while (true) {
            System.out.println("\n1.添加 2.查看 3.退出");
            System.out.print("选择: ");
            switch (sc.nextLine()) {
                case "1": add(); break;
                case "2": view(); break;
                case "3": return;
                default: System.out.println("无效输入");
            }
        }
    }

    private static void add() {
        try {
            System.out.print("学号: ");
            String id = sc.nextLine();
            System.out.print("姓名: ");
            String name = sc.nextLine();
            System.out.print("课程: ");
            String course = sc.nextLine();
            System.out.print("成绩: ");
            double score = Double.parseDouble(sc.nextLine());
            
            if (score < 0 || score > 100) {
                System.out.println("成绩无效");
                return;
            }
            
            students.put(id, new String[]{name, course, String.valueOf(score)});
            System.out.println("添加成功");
        } catch (Exception e) {
            System.out.println("输入错误");
        }
    }

    private static void view() {
        System.out.print("输入学号: ");
        String[] data = students.get(sc.nextLine());
        if (data == null) {
            System.out.println("无记录");
            return;
        }
        System.out.printf("姓名:%s 课程:%s 成绩:%s\n", data[0], data[1], data[2]);
    }
}